#pragma once

#include "my_mem.h"

typedef my_mem_freelists_t              my_thread_mem_freelists_t;
typedef my_4kaligned_mem_freelists_t    my_thread_4kaligned_mem_freelists_t;


my_thread_mem_freelists_t *
my_thread_mem_freelists_create(int64_t water_level);

void *
my_thread_mem_freelists_alloc(my_thread_mem_freelists_t *freelists, size_t size);

void
my_thread_mem_freelists_free(my_thread_mem_freelists_t *freelists, void *ptr);

void
my_thread_mem_freelists_destroy(my_thread_mem_freelists_t *freelists);

static inline void *
my_thread_mem_freelists_calloc(my_thread_mem_freelists_t *freelists, size_t size)
{
    void *ptr = my_thread_mem_freelists_alloc(freelists, size);
    bzero(ptr, size);
    return ptr;
}



my_thread_4kaligned_mem_freelists_t *
my_thread_4kaligned_mem_freelists_create(int64_t water_level);

void *
my_thread_4kaligned_mem_freelists_alloc(
    my_thread_4kaligned_mem_freelists_t *freelists, size_t size);

void
my_thread_4kaligned_mem_freelists_free(
    my_thread_4kaligned_mem_freelists_t *freelists, void *ptr);

void
my_thread_4kaligned_mem_freelists_destroy(
    my_thread_4kaligned_mem_freelists_t *freelists);